#lang racket/base
(provide
 stx/loc
 identifier-bound?)
(require
 racket/list
 syntax/parse)

(define-syntax-rule (stx/loc x)
  (syntax/loc this-syntax x))

;; id -> boolean
;; id int-def-ctx -> boolean
;| returns #t if the given identifier is bound in any of
;| the given internal-definition-contexts.
(define (identifier-bound? x [ctxs '()])
  (define xs
    (append-map internal-definition-context-binding-identifiers
                ctxs))
  (and (member x xs free-identifier=?) #t))
